function getNowFormatDate() {
	var date = new Date();
	var seperator1 = "";
	var year = date.getFullYear();
	var month = date.getMonth() + 1;
	var strDate = date.getDate();
	if(month >= 1 && month <= 9) {
		month = "0" + month;
	}
	if(strDate >= 0 && strDate <= 9) {
		strDate = "0" + strDate;
	}
	var currentdate = year + seperator1 + month + seperator1 + strDate;
	return currentdate;
};

//var md5 = hex_md5('lptx' + getNowFormatDate() + 'hQhY,1106');

/*时间戳转时间*/
function formatDate(value) {
	var date = new Date(value * 1000);
	var y = date.getFullYear();
	var MM = date.getMonth() + 1;
	MM = MM < 10 ? ('0' + MM) : MM;
	var d = date.getDate();
	d = d < 10 ? ('0' + d) : d;
	var h = date.getHours();
	h = h < 10 ? ('0' + h) : h;
	var m = date.getMinutes();
	m = m < 10 ? ('0' + m) : m;
	var s = date.getSeconds();
	s = s < 10 ? ('0' + s) : s;
	return y + '年' + MM + '月' + d + '日' + h + ':' + m ;
}

function formatDate1(value) {
	var date = new Date(value * 1000);
	var y = date.getFullYear();
	var MM = date.getMonth() + 1;
	MM = MM < 10 ? ('0' + MM) : MM;
	var d = date.getDate();
	d = d < 10 ? ('0' + d) : d;
	var h = date.getHours();
	h = h < 10 ? ('0' + h) : h;
	var m = date.getMinutes();
	m = m < 10 ? ('0' + m) : m;
	var s = date.getSeconds();
	s = s < 10 ? ('0' + s) : s;
	return y + '年' + MM + '月' + d+'日';
}

function formatDate2(value) {
	var date = new Date(value * 1000);
	var y = date.getFullYear();
	var MM = date.getMonth() + 1;
	MM = MM < 10 ? ('0' + MM) : MM;
	var d = date.getDate();
	d = d < 10 ? ('0' + d) : d;
	var h = date.getHours();
	h = h < 10 ? ('0' + h) : h;
	var m = date.getMinutes();
	m = m < 10 ? ('0' + m) : m;
	var s = date.getSeconds();
	s = s < 10 ? ('0' + s) : s;
	return y + '-' + MM + '-' + d;
}

/*获取URL后的参数*/

function GetRequest() {   
       var url = window.location.search; //获取url中"?"符后的字串   
       var theRequest = new Object();   
       if (url.indexOf("?") != -1) {   
          var str = url.substr(1);   
          strs = str.split("&");   
          for(var i = 0; i < strs.length; i ++) {   
              //就是这句的问题
             theRequest[strs[i].split("=")[0]]=decodeURI(strs[i].split("=")[1]); 
             //之前用了unescape()
             //才会出现乱码  
          }   
       }   
       return theRequest;   
    }



//金额转换
function figureChange(num) {
	if(num < 1000){
		if(num%100!=0){
			return +((num / 100).toFixed(10))*100;
		}else{
			return +(num / 100).toFixed(10)*100;
		}		 
	}else if(num < 10000){
		return +(num / 1000).toFixed(10) + "千";
	}else{
		return +(num / 10000).toFixed(10) + "万";
	}
	
}
//限制文本输入
function confine_num(area, txt, num) {
	$(area).on("keyup", function() {
		$(txt).text($(area).val().length); //这句是在键盘按下时，实时的显示字数
		if($(area).val().length > num) {
			$(txt).text(num); //长度大于100时0处显示的也只是100    
			$(area).val($(area).val().substring(0, num)); //长度大于100时截取钱100个字符
		}
	})
	$(txt).text($(area).val().length); //这句是在刷新的时候仍然显示字数
	
}




//判断页面时候有touken
function isLogin() {
	if(sessionStorage.getItem("UDC_info") === null) {
		$.toast('你还未登录！', "text");
		setTimeout(function() {
			window.parent.location.href = '../login/login.html'
		}, 3000)
	}
}



function timestampFormat( timestamp ) {
    function zeroize( num ) {
        return (String(num).length == 1 ? '0' : '') + num;
    }
   
    var curTimestamp = parseInt(new Date().getTime()); //当前时间戳
    var timestampDiff = curTimestamp - timestamp; // 参数时间戳与当前时间戳相差秒数
   
    var curDate = new Date( curTimestamp  ); // 当前时间日期对象
    var tmDate = new Date( timestamp );  // 参数时间戳转换成的日期对象
   
    var Y = tmDate.getFullYear(), m = tmDate.getMonth() + 1, d = tmDate.getDate();
    var H = tmDate.getHours(), i = tmDate.getMinutes(), s = tmDate.getSeconds();
   
    if ( curDate.getFullYear() == Y && curDate.getMonth()+1 == m && curDate.getDate() == d ) {
        return  zeroize(H) + ':' + zeroize(i);
    } else {
        var newDate = new Date( (curTimestamp - 86400) * 1000 ); // 参数中的时间戳加一天转换成的日期对象
        if ( newDate.getFullYear() == Y && newDate.getMonth()+1 == m && newDate.getDate() == d ) {
            return '昨天' + zeroize(H) + ':' + zeroize(i);
        } else if ( curDate.getFullYear() == Y ) {
            return  zeroize(m) + '月' + zeroize(d) + '日 ' + zeroize(H) + ':' + zeroize(i);
        } else {
            return  Y + '年' + zeroize(m) + '月' + zeroize(d) + '日 ' + zeroize(H) + ':' + zeroize(i);
        }
    }
}



　　
 






 